﻿using System.Text;

namespace Elderos.Utils.Web
{
	public class WebArgs
	{
		public WebArgs(byte[] contentBytes, Encoding encoding)
		{
			ContentBytes = contentBytes;
			Encoding = encoding;
		}

		public Encoding Encoding { get; set; }
		public byte[] ContentBytes { get; private set; }

		public StringBuilder Content
		{
			get
			{
				var builder = new StringBuilder();
				builder.Append(
					Encoding != null
						? Encoding.GetString(ContentBytes)
						: Encoding.UTF8.GetString(ContentBytes));
				return builder;
			}
		}
	}
}